package com.itheima02.service;

import com.itheima02.dao.StudentDao;
import com.itheima02.dao.StudentMapper;
import com.itheima02.domain.Student;

import java.io.IOException;
import java.util.List;

public class StudentService {

    public List queryAll() {
        StudentDao sd=new StudentDao();
        List list=sd.findAll();
        return list;
    }

    public void save(Student stu) {
        StudentDao sd=new StudentDao();
        sd.insert(stu);


    }

    public void delete(String id)  {
     StudentDao studentDao=new StudentDao();
     studentDao.delete(id);
    }

    public void update( Student stu) throws IOException {
        StudentMapper sm= new StudentMapper();
        sm.update(stu);
    }

    public Student findById(String id) throws IOException {
        return  new StudentMapper().findById(id);


    }
}
